package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.AlertRuleDto;
import com.zzyl.entity.AlertData;
import com.zzyl.entity.AlertRule;
import com.zzyl.entity.Balance;
import com.zzyl.vo.AlertRuleVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * BalanceMapper接口
 */
@Mapper
public interface AlertRuleMapper {

    void create(AlertRule alertRule);

    Page<AlertRuleVo> getPage(String alertRuleName, String functionName, String productKey);

    AlertRuleVo getById(Long id);

    void updateById(AlertRule alertRule);

    void deleteById(Long id);

    Integer selectStatus(Long id);

    List<AlertRule> selectAllRule(String iotId,String functionId,String productKey);

    List<Long> queryDeviceElder(String iotId);

    List<Long> queryDeviceElderAndBed(String iotId);

    @Select("select sur.user_id from sys_user_role  sur left join sys_role sr on sur.role_id = sr.id \n" +
            "where sr.role_name  = #{roleName}")
    List<Long> queryDeviceRepair(String deviceMaintainerRole);

    void batchInsert(List<AlertData> list);

}
